Explaining Data Modeling and Relationship Concepts in Interviews
Course: Microsoft Power BI Training
Topic: Explaining Data Modeling and Relationship Concepts in Interviews
Course Link: Microsoft Power BI Training
Demo Link: Register for a Course Demo
Website: JustAcademy
1. Introduction to Data Modeling in Power BI
Data modeling is one of the most important concepts in Microsoft Power BI. It involves organizing tables, defining relationships, selecting appropriate keys, and preparing data so that calculations and reports produce accurate results.
In a business environment, data is often stored across multiple tables and systems. For example, a retail organization may maintain separate tables for sales transactions, products, customers, employees, and dates. Data modeling establishes how these tables connect and how information flows between them during analysis.
In interviews, candidates are often asked about data modeling because it demonstrates their understanding of how Power BI calculates results, handles filters, and supports reliable reporting.
A strong data model helps to:
- Reduce unnecessary duplication of data.
- Establish logical connections between tables.
- Improve report accuracy.
- Support reusable DAX measures.
- Improve report performance and maintainability.
- Make business reports easier to understand.
- Enable analysis across different business dimensions.
Example
Suppose a company wants to analyze sales by product, customer, region, and month. Instead of storing every product and customer detail repeatedly in one large table, Power BI can use separate dimension tables connected to a Sales fact table.
This design allows users to select a product category or region and see the corresponding sales results automatically.
2. Learning Objectives
After completing this topic, learners should be able to:
- Explain data modeling in simple interview-friendly language.
- Understand fact tables and dimension tables.
- Explain star schema and snowflake schema.
- Understand primary keys, foreign keys, and surrogate keys.
- Explain relationship cardinality and cross-filter direction.
- Differentiate active and inactive relationships.
- Understand one-to-one, one-to-many, and many-to-many relationships.
- Explain filter propagation in Power BI.
- Create and troubleshoot relationships in Model view.
- Understand date tables and role-playing dimensions.
- Identify common data modeling mistakes.
- Answer practical data modeling interview questions confidently.
3. What Is Data Modeling?
Data modeling is the process of structuring data into related tables so that information can be analyzed accurately and efficiently.
In Power BI, data modeling typically includes:
- Organizing source data into logical tables.
- Identifying fact and dimension tables.
- Defining relationships between tables.
- Choosing suitable keys and data types.
- Creating measures using DAX.
- Configuring filter behavior.
- Designing a model that supports the required reports.
Interview Question: What is data modeling in Power BI?
Sample Answer: Data modeling in Power BI is the process of organizing tables and establishing relationships between them so that users can analyze data accurately. It includes identifying fact and dimension tables, selecting appropriate keys, configuring relationships, and creating a structure that supports reliable calculations and efficient reporting.
Why Is Data Modeling Important?
| Benefit |
Explanation |
| Accuracy |
Correct relationships help ensure that filters and calculations return expected results. |
| Performance |
A well-designed model can reduce unnecessary complexity and improve query efficiency. |
| Reusability |
Measures can be reused across multiple report pages and visuals. |
| Maintainability |
Logical tables and relationships make the model easier to update. |
| Usability |
Users can analyze information using meaningful fields such as product, region, and date. |
| Scalability |
A suitable design can accommodate growing data and changing reporting needs. |
4. Understanding Tables in a Data Model
Tables are the basic building blocks of a Power BI semantic model. Each table contains columns and rows representing related information.
For example, a Customers table stores customer details, while a Sales table stores sales transactions.
4.1 Fact Table
A fact table stores business events, transactions, or measurable observations. It usually contains numeric values and keys that connect it to dimension tables.
Examples of fact tables include:
- Sales transactions.
- Purchase orders.
- Inventory movements.
- Website visits.
- Customer payments.
- Budget records.
A Sales fact table may contain the following columns:
| OrderID |
ProductID |
CustomerID |
DateKey |
Quantity |
SalesAmount |
| 1001 |
P01 |
C01 |
20261001 |
2 |
2000 |
| 1002 |
P02 |
C02 |
20261002 |
1 |
1500 |
| 1003 |
P01 |
C03 |
20261003 |
3 |
3000 |
The table records individual sales events and includes keys that connect transactions to products, customers, and dates.
4.2 Dimension Table
A dimension table contains descriptive attributes used to filter, group, and categorize business data.
Examples include:
- Products.
- Customers.
- Employees.
- Regions.
- Dates.
- Suppliers.
Example Products table:
| ProductID |
ProductName |
Category |
UnitPrice |
| P01 |
Laptop |
Electronics |
1000 |
| P02 |
Office Chair |
Furniture |
1500 |
The ProductID column identifies each product, while ProductName and Category provide descriptive information.
4.3 Difference Between Fact and Dimension Tables
| Feature |
Fact Table |
Dimension Table |
| Purpose |
Stores business events and measurements. |
Stores descriptive information. |
| Typical Content |
Quantity, SalesAmount, Cost, TransactionDateKey. |
ProductName, CustomerName, Category, Region. |
| Rows |
Often many transaction-level rows. |
Often fewer descriptive records. |
| Keys |
Usually contains foreign keys to dimensions. |
Usually contains a unique key on the one side of a relationship. |
| Use in Reports |
Provides values for aggregation. |
Provides fields for filtering and grouping. |
Interview Question: What is the difference between a fact table and a dimension table?
Sample Answer: A fact table stores business events and measurable values, such as sales amount or quantity. A dimension table stores descriptive attributes, such as product name, customer, or region. Dimension tables are used to filter and group the data in fact tables.
5. Understanding Granularity or Grain
Granularity, also called grain, describes exactly what one row in a fact table represents.
For example, one row in a Sales table may represent:
- One individual order line.
- One complete order.
- One product's sales for a particular day.
- One region's sales for a month.
These are different levels of detail. A modeler must understand the grain before combining facts or writing calculations.
Example
If one order contains three different products, an order-line fact table may contain three rows for that order. Counting rows would count three lines, not one order.
To count distinct orders, a suitable measure might be:
Total Orders =
DISTINCTCOUNT ( Sales[OrderID] )
Interview Question: What is granularity in data modeling?
Sample Answer: Granularity defines the level of detail represented by each row in a table. For example, a sales table may store one row per order line or one row per product per month. Understanding grain is important because it affects relationships, aggregation, and the accuracy of calculations.
6. Understanding Primary Keys and Foreign Keys
Keys are used to identify records and connect related tables.
6.1 Primary Key
A primary key uniquely identifies each record in a table.
Example: ProductID in the Products table.
| ProductID |
ProductName |
| P01 |
Laptop |
| P02 |
Keyboard |
| P03 |
Mouse |
Each ProductID should identify exactly one product record.
6.2 Foreign Key
A foreign key is a column that refers to a key in another table. In Power BI, a fact table commonly contains foreign keys used to establish relationships with dimension tables.
Example: ProductID in the Sales table refers to ProductID in the Products table.
6.3 Surrogate Key
A surrogate key is an artificial identifier created to uniquely identify a record. It does not need to carry business meaning.
For example, a warehouse may assign ProductKey values 1, 2, and 3 to products instead of using product codes supplied by the source system.
Interview Question: What is the difference between a primary key and a foreign key?
Sample Answer: A primary key uniquely identifies a row in its own table. A foreign key refers to a related key in another table and helps connect the data. For example, ProductID can uniquely identify a product in the Products table and appear repeatedly in the Sales table.
7. Understanding Relationships in Power BI
A relationship connects columns from two different tables. It allows filters applied to one table to affect related data in another table, provided that a valid relationship path exists.
For example, when a user selects the Electronics category in a product slicer, the Products table filters the related Sales table. A sales measure then calculates the sales for the selected category.
7.1 Example of a Relationship
Products table:
| ProductID |
ProductName |
Category |
| P01 |
Laptop |
Electronics |
| P02 |
Chair |
Furniture |
Sales table:
| OrderID |
ProductID |
SalesAmount |
| 101 |
P01 |
2000 |
| 102 |
P02 |
1500 |
| 103 |
P01 |
3000 |
ProductID connects the Products table to the Sales table.
Products Sales
------------------ ----------------------
ProductID (1) ----------------> ProductID (*)
ProductName OrderID
Category SalesAmount
The relationship allows Power BI to calculate total sales by product category without storing the category name repeatedly in every sales row.
Interview Question: What is a relationship in Power BI?
Sample Answer: A relationship connects columns in different tables and establishes how filters propagate through the model. Relationships allow a report to combine descriptive fields from dimension tables with measures calculated from fact tables.
8. Types of Relationship Cardinality
Cardinality defines how values in one table relate to values in another table. The correct cardinality depends on the uniqueness of the related columns and the business meaning of the data.
8.1 One-to-Many Relationship (1:*)
A one-to-many relationship means one row on the first side can relate to multiple rows on the second side.
Example: One product can appear in many sales transactions.
Products (1) --------> Sales (*)
One product Many sales rows
This is one of the most common relationships in Power BI star schemas.
Interview Answer: A one-to-many relationship exists when a unique record in one table can match multiple records in another table. For example, one customer can have many sales transactions.
8.2 Many-to-One Relationship (*:1)
This is the same relationship viewed from the opposite direction. Many rows in one table refer to one row in another table.
Example: Many Sales rows can refer to one Product record.
Interview Answer: A many-to-one relationship means multiple records on one side relate to a unique record on the other side. It is the reverse perspective of a one-to-many relationship.
8.3 One-to-One Relationship (1:1)
A one-to-one relationship exists when each key value on one side matches at most one key value on the other side.
Example: An Employee table and an EmployeeAdditionalDetails table may each contain one row per employee.
This design can be useful when information is intentionally split across tables, although it is worth checking whether combining the tables would simplify the model.
Interview Answer: A one-to-one relationship means each record in one table corresponds to at most one record in the other table. It may be used when attributes are separated for security, organization, or design reasons.
8.4 Many-to-Many Relationship (*:*)
A many-to-many relationship exists when key values can repeat on both sides.
Example: Multiple students can enroll in multiple courses. A student can attend several courses, and each course can have many students.
Students (*) -------- (*) Courses
In a robust model, an Enrollment bridge table is often used to represent the student-course combinations.
| StudentID |
CourseID |
| S01 |
C01 |
| S01 |
C02 |
| S02 |
C01 |
The bridge table represents the combinations and can help create clearer filter paths between the dimensions.
Interview Answer: A many-to-many relationship occurs when multiple values in one table can match multiple values in another. I would evaluate whether a bridge table or another modeling pattern is appropriate to avoid ambiguous filters and incorrect aggregation.
8.5 Cardinality Comparison
| Cardinality |
Meaning |
Example |
| One-to-One |
One record matches at most one record. |
Employee and employee detail records. |
| One-to-Many |
One record can match many records. |
One product and many sales rows. |
| Many-to-One |
Many records match one record. |
Many sales rows and one product. |
| Many-to-Many |
Multiple values match multiple values. |
Students and courses. |
9. Understanding Cross-Filter Direction
Cross-filter direction determines how filters propagate across a relationship.
9.1 Single-Direction Filtering
With single-direction filtering, filters typically flow from the one side of a one-to-many relationship to the many side.
Example:
Products (1) --------> Sales (*)
Filter Products Filter Sales
If a report user selects a product category, the filter affects the Sales table. This is a common and recommended pattern for straightforward star schemas.
9.2 Both-Direction Filtering
With bidirectional filtering, filters can propagate in both directions across a relationship.
Table A <----------> Table B
Bidirectional filtering can be useful in specific models, but it should not be enabled automatically for every relationship. It can create ambiguous filter paths, unexpected results, or performance issues in more complex models.
Interview Question: What is cross-filter direction?
Sample Answer: Cross-filter direction controls how filters travel between related tables. Single direction is common in star schemas because dimension tables filter fact tables. Both-direction filtering allows filters to flow in both directions, but I use it only when the model requires it and the resulting filter paths are unambiguous.
10. Active and Inactive Relationships
A relationship can be active or inactive. An active relationship is used by default when Power BI propagates filters between tables. An inactive relationship is available for specific calculations but does not automatically propagate filters as the default path.
10.1 Active Relationship
Suppose the Sales table has an OrderDate column and a Date table has a Date column. An active relationship can connect these columns so date slicers filter sales by order date.
10.2 Inactive Relationship
Suppose Sales contains OrderDate and ShipDate. The same Date table may need relationships to both columns, but only one relationship between the same pair of tables can be active at a time in the usual modeling pattern.
The relationship to ShipDate can be inactive while OrderDate remains active.
A measure can activate the inactive relationship for a specific calculation by using USERELATIONSHIP.
Sales by Ship Date =
CALCULATE (
[Total Sales],
USERELATIONSHIP (
Sales[ShipDate],
'Date'[Date]
)
)
This example assumes that a Date table exists, that a suitable relationship is defined between Date and ShipDate, and that the Total Sales measure is already defined.
Interview Question: What is the difference between active and inactive relationships?
Sample Answer: An active relationship is the default path for filter propagation. An inactive relationship does not automatically filter through that path, but it can be used in a measure with USERELATIONSHIP. This is useful when analyzing different date roles, such as order date and shipment date.
11. What Is a Star Schema?
A star schema is a data modeling design in which a central fact table connects to multiple dimension tables. It is widely used in analytical models because it provides a clear structure for filtering, grouping, and summarizing data.
11.1 Example of a Star Schema
Date
|
|
Customers ------ Sales ------ Products
|
|
Region
In this model:
- Sales is the central fact table.
- Customers provides customer attributes.
- Products provides product details.
- Date provides calendar attributes.
- Region provides regional descriptions.
11.2 Advantages of a Star Schema
- Simple and intuitive table structure.
- Clear relationships between dimensions and facts.
- Convenient filtering and grouping in reports.
- Good support for reusable DAX measures.
- Potential performance benefits from a well-designed model.
- Easier maintenance and troubleshooting.
Interview Question: Why do you prefer a star schema in Power BI?
Sample Answer: I prefer a star schema for many analytical reporting scenarios because it separates descriptive attributes from transactional facts. Dimension tables support filtering and grouping, while fact tables support aggregation. This structure makes relationships easier to understand and can improve model usability and performance.
12. What Is a Snowflake Schema?
A snowflake schema is a model in which dimension information is split into multiple related tables rather than being stored in a single denormalized dimension.
For example, Products may connect to a separate Categories table, and Categories may connect to a Departments table.
Departments
|
Categories
|
Products
|
Sales
12.1 Advantages
- Can reduce repeated descriptive information across dimension tables.
- Can reflect an existing normalized source structure.
- May make certain hierarchies easier to manage centrally.
12.2 Disadvantages
- Creates more tables and relationships.
- Can make the model harder for report users to understand.
- May introduce additional filter paths and modeling complexity.
Interview Question: What is the difference between a star schema and a snowflake schema?
Sample Answer: In a star schema, dimension attributes are generally grouped into single dimension tables connected directly to a fact table. In a snowflake schema, dimension information is normalized into additional related tables. A star schema is often simpler for Power BI reporting, while a snowflake schema may be appropriate when the underlying structure or business requirements justify it.
13. Understanding Normalization and Denormalization
Normalization organizes data to reduce unnecessary duplication and maintain consistency. Denormalization combines related information to simplify access or improve particular analytical workflows.
13.1 Normalization Example
Instead of repeating the product name and category in every sales record, the Sales table stores ProductID and the Products table stores the descriptive attributes.
13.2 Denormalization Example
A reporting table may contain ProductID, ProductName, Category, OrderID, and SalesAmount in the same table. This may simplify some reporting tasks but can repeat product information across many rows.
Interview Question: Is normalization always better in Power BI?
Sample Answer: Not necessarily. Power BI models should be designed for analytical usability and performance, not simply to maximize normalization. A star schema often works well because it separates facts and dimensions while keeping the report structure simple. The best design depends on data volume, source architecture, and reporting requirements.
14. Understanding Filter Propagation
Filter propagation describes how a filter applied to one table affects related tables through the model's relationships.
Example
A report user selects the Electronics category in a slicer. Power BI applies the filter to the Products table, which then filters the Sales table through the relationship. A Total Sales measure calculates the sales associated with the selected category.
Category = Electronics
|
v
Products
|
v
Sales
|
v
Total Sales
Interview Question: What happens when a user selects a slicer in Power BI?
Sample Answer: The slicer applies a filter to the relevant column. If relationships provide a valid filter path, the filter propagates to related tables. The visual queries are then evaluated under the resulting filter context, so measures return values for the selected data.
15. Understanding Relationship Errors
Incorrect relationships can cause missing values, duplicated totals, confusing visuals, or errors when creating a relationship.
15.1 Duplicate Values on the One Side
For a one-to-many relationship, the column on the one side must contain unique key values. If ProductID contains duplicates in the Products table, Power BI may reject the relationship.
Solution: Investigate the duplicate records. Correct the source data or create a properly designed dimension table with unique keys. Do not remove duplicates without understanding whether they represent legitimate business records.
15.2 Incompatible Data Types
A relationship may not work correctly if one key is stored as text and the other as a number, or if date columns use incompatible types.
Solution: Standardize the related columns to compatible data types and validate their values.
15.3 Unmatched Keys
Some fact table keys may not exist in the related dimension table. This can occur when data sources are updated at different times or contain invalid identifiers.
Solution: Use Power Query anti joins or data-quality checks to identify unmatched records and decide how they should be handled.
15.4 Ambiguous Relationships
Multiple active paths between tables can create ambiguity about how filters should propagate.
Solution: Review the model structure, active relationships, and cross-filter directions. Consider simplifying the model or using an inactive relationship for a specific measure.
15.5 Incorrect Totals
Incorrect totals can result from duplicate dimension keys, unexpected many-to-many behavior, wrong filter context, or inappropriate aggregation.
Solution: Verify the table grain, relationship cardinality, source totals, and DAX measure logic.
16. How to Create Relationships in Power BI Desktop
In an interview, you may be asked to explain how you create a relationship practically.
- Open Power BI Desktop and load the required tables.
- Open Model view.
- Inspect the available columns and table structure.
- Identify the matching key columns.
- Confirm that the key columns have compatible data types.
- Verify uniqueness on the expected one side.
- Drag a key column from one table to the corresponding column in another table, or open Modeling > Manage relationships > New.
- Select the appropriate cardinality.
- Choose the cross-filter direction.
- Set the relationship as active or inactive as required.
- Confirm the relationship.
- Test it with a visual using fields from both tables.
- Validate the resulting totals and filter behavior.
Power BI may automatically detect relationships when data is loaded. Automatically created relationships should still be reviewed because matching column names do not always guarantee the correct business relationship.
17. Best Practices for Data Modeling Interviews
- Understand the business purpose of each table before creating relationships.
- Identify the grain of every fact table.
- Use stable and reliable keys.
- Prefer one-to-many relationships from dimensions to facts where appropriate.
- Use a star schema as a strong starting point for analytical models.
- Keep related columns in compatible data types.
- Ensure dimension keys are unique when they are on the one side.
- Avoid unnecessary bidirectional filtering.
- Use inactive relationships and USERELATIONSHIP for suitable alternative calculation paths.
- Investigate many-to-many relationships carefully.
- Validate calculations against trusted source results.
- Document important assumptions and business definitions.
18. Data Modeling Interview Questions and Answers
Q1. What is data modeling in Power BI?
Answer: Data modeling is the process of organizing data into related tables so that Power BI can filter, group, and calculate business information correctly. It includes defining keys, relationships, table roles, and measures.
Q2. What is the difference between a fact table and a dimension table?
Answer: A fact table stores transactions and measurable values, while a dimension table stores descriptive attributes used for filtering and grouping.
Q3. What is a relationship in Power BI?
Answer: A relationship connects columns in two tables and defines how filters propagate between them.
Q4. What are the different types of relationships?
Answer: The common cardinality types are one-to-one, one-to-many, many-to-one, and many-to-many.
Q5. Which relationship type is commonly used in a star schema?
Answer: One-to-many is commonly used, with a unique dimension key on the one side and repeated foreign keys in the fact table on the many side.
Q6. What is a star schema?
Answer: A star schema contains a central fact table connected to dimension tables, allowing facts to be summarized by descriptive attributes.
Q7. What is a snowflake schema?
Answer: A snowflake schema splits dimension information into additional related tables, creating a more normalized structure.
Q8. What is cardinality?
Answer: Cardinality defines how records relate across two tables, such as one-to-many or many-to-many.
Q9. What is cross-filter direction?
Answer: Cross-filter direction defines how filters travel between related tables. Single direction is common in star schemas, while bidirectional filtering is used selectively.
Q10. What is the difference between active and inactive relationships?
Answer: Active relationships are used by default for filter propagation. Inactive relationships are not the default path but can be activated in specific measures using USERELATIONSHIP.
Q11. What is a primary key?
Answer: A primary key uniquely identifies a record in a table.
Q12. What is a foreign key?
Answer: A foreign key refers to a related key in another table and helps connect the tables.
Q13. What is a surrogate key?
Answer: A surrogate key is an artificial identifier created to uniquely identify records, often used when the source does not provide a suitable unique key.
Q14. What is granularity?
Answer: Granularity is the level of detail represented by one row in a table, such as one sales order line or one product's monthly sales.
Q15. Why should unnecessary many-to-many relationships be avoided?
Answer: They can make filter behavior and aggregation more difficult to understand. A bridge table or a better-defined dimensional model may provide clearer and more reliable results.
Q16. Why might Power BI reject a one-to-many relationship?
Answer: The column on the one side may contain duplicate values, or the relationship columns may have incompatible data types. I would check uniqueness, data types, and data quality before changing cardinality.
Q17. How do you troubleshoot incorrect totals?
Answer: I check the grain of the fact table, duplicate keys, relationship paths, filter direction, DAX measure definitions, and source totals to identify the reason for the discrepancy.
Q18. What is a date dimension?
Answer: A date dimension is a table containing dates and related attributes such as year, quarter, month, and day. It supports consistent time-based filtering and analysis.
Q19. Can one Date table connect to multiple date columns in a fact table?
Answer: Yes. For example, a Date table can have relationships to OrderDate and ShipDate. In a common design, one relationship is active and another is inactive. Measures can use USERELATIONSHIP for calculations based on the inactive relationship.
Q20. What is filter propagation?
Answer: Filter propagation is the movement of filters across relationships. It enables a selection in a dimension table to affect the related rows used by a measure.
Q21. What is a bridge table?
Answer: A bridge table represents associations between entities and can be used to model many-to-many relationships. For example, an Enrollment table can connect students with courses.
Q22. How can you improve a Power BI data model?
Answer: I review the star schema, remove unused columns, use appropriate data types, simplify relationships, optimize measures, reduce unnecessary bidirectional filtering, and validate performance and accuracy.
Q23. Is it necessary to merge all tables into one table?
Answer: No. Separate fact and dimension tables with appropriate relationships are often preferable because they improve clarity and support reusable measures. Merging is useful when there is a clear requirement for it.
Q24. What happens when a dimension key is missing from the dimension table?
Answer: The fact row may not match a known dimension member. I would identify unmatched keys, investigate the source data, and decide whether to correct the data or represent the unknown member explicitly.
Q25. How would you explain your data model in an interview?
Answer: I would describe the business requirement, identify the fact table and its grain, explain the dimension tables and keys, describe relationship cardinality and filter direction, and demonstrate how the model supports the required measures and report visuals.
19. Scenario-Based Interview Questions
Scenario 1: Sales Totals Are Duplicated
Question: Your Power BI report displays a higher sales total after you connect the Products table to the Sales table. What would you check?
Answer: I would check whether ProductID is unique in the Products table, whether the relationship cardinality is correct, whether duplicate product records exist, and whether the merge or model introduces multiple matches. I would compare row counts and totals before and after the relationship or transformation.
Scenario 2: A Slicer Does Not Filter a Visual
Question: A Region slicer does not change the sales chart. How would you troubleshoot it?
Answer: I would check whether the Region table is connected to the Sales table through a valid relationship, whether the relationship is active, whether the filter direction is appropriate, and whether the visual interactions are enabled. I would also confirm that the selected region values match the model data.
Scenario 3: The Relationship Cannot Be Created
Question: Power BI reports that one of the relationship columns contains duplicate values. What would you do?
Answer: I would confirm which table should be the dimension and whether its key is expected to be unique. Then I would investigate duplicate records and determine whether the source needs correction or a separate dimension with unique keys is required. I would not remove duplicates without checking their business meaning.
Scenario 4: Analyze Sales by Order Date and Ship Date
Question: The Sales table contains both OrderDate and ShipDate. How would you analyze sales by each date?
Answer: One option is to use a Date table with an active relationship to OrderDate and an inactive relationship to ShipDate. A measure can use USERELATIONSHIP to calculate sales by shipment date. If users need to analyze both roles independently in the same report, separate role-playing Date tables may be more convenient.
Scenario 5: Design a Student-Course Model
Question: A student can enroll in multiple courses, and each course can have multiple students. How would you model this?
Answer: I would create Students and Courses dimension tables and an Enrollment bridge table containing StudentID and CourseID. The bridge table represents the student-course combinations and helps define clear relationships.
20. Practical Exercises
Exercise 1: Create a Sales Data Model
Create the following tables:
- Sales: OrderID, ProductID, CustomerID, DateKey, SalesAmount.
- Products: ProductID, ProductName, Category.
- Customers: CustomerID, CustomerName, City.
- Date: DateKey, Date, Month, Year.
Tasks:
- Identify the fact table and dimension tables.
- Determine the grain of the Sales table.
- Create the relationships.
- Set the correct cardinality and filter direction.
- Create a Total Sales measure.
- Build a chart showing sales by category and year.
- Validate the results.
Exercise 2: Troubleshoot Duplicate Product Keys
Create a Products table with duplicate ProductID values and try to create a one-to-many relationship with Sales.
Tasks:
- Observe the relationship error.
- Investigate why ProductID is duplicated.
- Decide whether the records represent duplicate data or different product versions.
- Design an appropriate dimension key.
- Recreate the relationship and validate the results.
Exercise 3: Model Order Date and Ship Date
Create a Sales table containing OrderDate, ShipDate, and SalesAmount, along with a Date table.
Tasks:
- Create an active relationship for OrderDate.
- Create an inactive relationship for ShipDate.
- Create a Total Sales measure.
- Create a second measure using USERELATIONSHIP.
- Compare sales by order date and ship date.
21. Final Interview Preparation Checklist
- ☐ I can explain data modeling in simple terms.
- ☐ I understand fact tables, dimension tables, and grain.
- ☐ I can explain primary keys, foreign keys, and surrogate keys.
- ☐ I understand one-to-one, one-to-many, and many-to-many relationships.
- ☐ I can compare star schema and snowflake schema.
- ☐ I understand single and bidirectional cross-filtering.
- ☐ I can explain active and inactive relationships.
- ☐ I understand filter propagation and relationship paths.
- ☐ I can create and validate relationships in Power BI Desktop.
- ☐ I can troubleshoot duplicate keys and unmatched records.
- ☐ I understand date tables and role-playing dimensions.
- ☐ I can explain modeling decisions using a practical project.
22. Quick Revision Summary
| Concept |
Key Point |
| Data Modeling |
Organizes data into related tables for accurate analysis. |
| Fact Table |
Stores business events and measurable values. |
| Dimension Table |
Stores descriptive attributes used for filtering and grouping. |
| Grain |
Defines what one row represents. |
| Primary Key |
Uniquely identifies a row in a table. |
| Foreign Key |
Connects a record to a related table. |
| One-to-Many |
One unique dimension record can match many fact records. |
| Many-to-Many |
Multiple values can match multiple values; a bridge table may help. |
| Star Schema |
Connects a central fact table to dimension tables. |
| Cross-Filter Direction |
Controls how filters propagate across relationships. |
| Active Relationship |
Provides the default relationship path for filtering. |
| Inactive Relationship |
Can be used in a specific measure with USERELATIONSHIP. |
| Filter Propagation |
Allows a selection in one table to affect related tables. |
| Bridge Table |
Represents associations between entities in a many-to-many pattern. |
23. Conclusion
Data modeling and relationship concepts are essential for building reliable Power BI reports. Understanding fact tables, dimension tables, keys, grain, cardinality, filter direction, and relationship behavior helps analysts and developers design models that return accurate results.
For interviews, focus on explaining not only what each concept means but also why it matters and how you would apply it to a real business scenario. Practical examples involving sales, products, customers, dates, and bridge tables can help demonstrate that you understand both the theory and the implementation.
To continue learning, explore the Microsoft Power BI Training course at JustAcademy and register for a course demo.
24. Additional Learning Resources